# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 139469 2015-08-18 01:10:17Z jmr@macports.org $

PortSystem              1.0
PortGroup               compiler_blacklist_versions 1.0
PortGroup               muniversal 1.0

name                    gettext
epoch                   2
version                 0.19.5
revision                1
categories              devel
maintainers             ryandesign
# libs are LGPL and executables are GPL
license                 {LGPL-2.1+ GPL-3+}
homepage                http://www.gnu.org/software/gettext/
master_sites            gnu
platforms               darwin freebsd linux
use_parallel_build      yes

description             GNU internationalization (i18n) and localization (l10n) library

long_description        ${name} is the ${description}, used for writing multilingual programs.

checksums               rmd160  28c5ada54bf88b6583759e8b9ea7324fbfe9a66b \
                        sha256  1258814ba174e4783194be2dc93648bd630d4dda166eae034e4ad54489dcf73a

# https://trac.macports.org/ticket/31167
compiler.blacklist-append   {clang < 211.10.1}

configure.cppflags      -no-cpp-precomp

configure.args          ac_cv_prog_AWK=/usr/bin/awk \
                        ac_cv_path_GREP=/usr/bin/grep \
                        ac_cv_path_SED=/usr/bin/sed \
                        --disable-csharp \
                        --disable-native-java \
                        --disable-openmp \
                        --without-emacs \
                        --with-included-gettext \
                        --with-included-glib \
                        --with-included-libcroco \
                        --with-included-libunistring \
                        --with-included-libxml

# Don't use possibly installed cvs or git to create the autopoint archive
# because the archives they create for each architecture under muniversal
# will differ and cannot be merged. Don't use xz either because then xz would
# be required by various ports that just want to use gettext.
configure.args-append   --without-cvs \
                        --without-git \
                        --without-xz

depends_lib             port:expat \
                        port:libiconv \
                        port:ncurses

platform darwin {
    if {${os.major} < 11} {
        patchfiles-append stpncpy.patch
    }
}

test.run                yes
test.target             check

post-destroot {
    if {[file exists ${destroot}${prefix}/lib/charset.alias]} {
        delete ${destroot}${prefix}/lib/charset.alias
    }
    if {[file exists ${destroot}${prefix}/share/locale/locale.alias]} {
        delete ${destroot}${prefix}/share/locale/locale.alias
    }
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        ChangeLog \
        ChangeLog.0 \
        DEPENDENCIES \
        HACKING \
        NEWS \
        README \
        THANKS \
        ${destroot}${prefix}/share/doc/${name}
}

livecheck.type          regex
livecheck.url           http://ftp.gnu.org/gnu/gettext/?C=M&O=D
livecheck.regex         ${name}-(\[0-9.\]+)\\.tar
